<!DOCTYPE html>
<html style="height: 100%;">
<head>
<title>我的订单</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css">
    <link rel="stylesheet" href="/static/css/my.css">
    <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/js/bootstrap.bundle.min.js"></script>
    <script src="/static/layer/layer/layer.js"></script>
<style>
        #top{background: #f60;}
        #bottom{background: #f7f7f7;}    
</style>
</head>
<body style="background-image: linear-gradient(to bottom,#f60, #fff);">
<div class="container-fluid" style="max-width: 800px;margin:0 auto;">
    <div id="header"></div>
    <div id="foot"></div>    
    <div id="top" class="row" class="text-center">
        <div class="col-1 text-center">
            <span class="bi-chevron-left btn-back"></span>            
        </div>
        <div class="col-10 text-center">我的订单</div>
        <div class="col-1 text"></div>
    </div>
    <div style="height:60px;"></div>

    <div id="content" style="background-color:#eee;border: 1px solid #fff;border-radius:5px;padding: 5px;">
    <table class="table table-sm table-striped" >
        <tr class="table-info" >
            <th>流水号</th>
            <th>价格</th>
            <th>状态</th>
            <th></th>
        </tr>

            {foreach $list['data'] as $k=>$kv}
            <tr>
                <td>{$kv['order_no']}</td>
                <td>{$kv['price1']}</td>
                <td>{$kv['status_name']}</td>
                <td class="text-nowrap" >
                    <button tyle="button" class="btn btn-sm btn-info">
                        <span class="bi-card-list" oid="{$kv['id']}"></span>
                    </button>
                    {if $kv['status']==1}
                    <button tyle="button" class="btn btn-sm btn-warning" oid="{$kv['id']}">
                        <span class="bi-trash" oid="{$kv['id']}"></span>
                    </button>                        
                    {/if}
                </td>
            </tr>
            {/foreach}


    </table>

    {include file="common/pagination"}

    </div>
    <div id="mask" style=""></div>
    <div id="goods_list" style="position: fixed;bottom: 0;width:99%;max-width: 800px;background-color: #fff; z-index: 20;">
        <table class="table table-sm table-striped" style="width:100%;">
            
        </table>
    </div>
</div>
</body>

<script type="text/javascript">

  $(document).ready(function(){
    $("#goods_list,#mask").on('click',function(e){
        $("#goods_list").hide();
        $("#mask").hide();
    })

    $(".btn-back").on('click',function(){
        window.history.back();
    })

    $(".bi-chat-dots").on('click',function(e){
        location.href="/index.php/comments/comm_edit/order_id/"+$(this).attr('oid');
    })



    $(".bi-card-list").on('click',function(){
        var oid =$(this).attr('oid');
        $.ajax({
            type:'post',
            data:{id:oid,ajax:1},
            url:'/index.php/order/order_list/id'+oid,
            dataType:'json',
            success:function(res){
                res = JSON.parse(res);//console.log(res);


            }
        })


    })

    $(".bi-trash").on('click',function(){
        var oid =$(this).attr('oid');

        layer.confirm('是否确认取消订单?', {
          btn: ['Yes','No'] //按钮
        }, function(){
            $.ajax({
                type:'post',
                data:{id:oid,ajax:1,memo:'客户取消'},
                url:'/index.php/order/order_cancel/id'+oid,
                dataType:'json',
                success:function(res){
                    res = JSON.parse(res);
                    layer.msg(res.msg);
                    if(res.msg) location.reload();
                }
            })
        }, function(){
             layer.msg('yes!');
            //  return false;
        });        



    })    



     
  })

</script>


</body>
</html>
